/* 
 * File:   trials.h
 * Author: Administrator
 *
 * Created on 2013?8?16?, ??10:18
 */
#include "commons.h"

#ifndef TRIALS_H
#define	TRIALS_H

#ifdef	__cplusplus
extern "C" {
#endif




#ifdef	__cplusplus
}
#endif

struct flagStruct {
    unsigned lick : 1;
    unsigned aa : 1;
    unsigned bb : 1;
    unsigned ab : 1;
    unsigned ba : 1;
    unsigned aca : 1;
    unsigned acb : 1;
    unsigned bca : 1;
    unsigned bcb : 1;
    unsigned ada : 1;
    unsigned adb : 1;
    unsigned bda : 1;
    unsigned bdb : 1;
    unsigned Fi : 1;
    unsigned Fj : 1;
    unsigned Fn : 1;
    unsigned Fl : 1;
    unsigned Fk : 1;
    unsigned pun : 1;
    unsigned punable : 1;
};


extern unsigned char text7[16];
extern unsigned char text7_2[16];
extern unsigned char text7_3[16];
extern unsigned char text7_4[16];
extern unsigned char text7_5[16];
extern unsigned char text8[16];
extern unsigned char text8_2[16];
extern unsigned char text9[16];
extern unsigned char text10[16];
extern unsigned char text11[2]; // S1
extern unsigned char text12[2]; // S2
extern unsigned char text13[2]; // S3
extern unsigned char text14[2]; // S4
extern unsigned char text15[2]; // S5
extern struct flagStruct Flags;

extern int ValDisVer1;
extern int ValDisVer2;

extern unsigned int hit, miss, falseAlarm, correctRejection, od, in, correctRatio; //???mice??????
extern int currentMiss;
extern unsigned int r2, m2, c2, w2;
















void test_water(void);
void test_odorA(void);
void test_odorB(void);
void test_BNC(void);
void test_valve (int port);
void auto_test_valve(void);

void AB_BA_Go(int Odor1, int Odor1BNC, float FirstOdorStart, float FirstOdorEnd, int Odor2, int Odor2BNC, float SecondOdorStart, float SecondOdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int TrialNuminSession, int SessionNum) ;
void AA_BB_Go(int Odor1, int Odor1BNC, float FirstOdorStart, float FirstOdorEnd, int Odor2, int Odor2BNC, float SecondOdorStart, float SecondOdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int TrialNuminSession, int SessionNum) ;
void TwoOdorDelayMatchTask(int Odor1, int Odor1BNC, float FirstOdorStart, float FirstOdorEnd, int Odor2, int Odor2BNC, float SecondOdorStart, float SecondOdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Rule, int TrialNuminSession, int SessionNum) ;
void Go_noGo(int Odor1, int Odor1BNC, int Odor2, int Odor2BNC, float OdorStart, float OdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Rule, int TrialNuminSession, int SessionNum) ;
void RandomGoNogo(int Odor1, int Odor1BNC, int Odor2, int Odor2BNC, float OdorStart, float OdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Rule, int TrialNuminSession, int SessionNum) ;

void TwoOdorDelayMatchTaskWithTrigger(int Odor1, int Odor1BNC, float FirstOdorStart, float FirstOdorEnd, int Odor2, int Odor2BNC, float SecondOdorStart, float SecondOdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Trigger1, float Trigger1Start, float Trigger1End, int Rule, int TrialNuminSession, int SessionNum) ;
void TwoOdorDelayMatchTaskWithTwoTrigger(int Odor1, int Odor1BNC, float FirstOdorStart, float FirstOdorEnd, int Odor2, int Odor2BNC, float SecondOdorStart, float SecondOdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Trigger1, float Trigger1Start, float Trigger1End, int Trigger2, float Trigger2Start, float Trigger2End, int Rule, int TrialNuminSession, int SessionNum) ;
void TwoOdorVaryingTasks(int Odor1, int Odor1BNC, int Odor2, int Odor2BNC, float FirstOdorStart1, float FirstOdorEnd1, float SecondOdorStart1, float SecondOdorEnd1, float FirstOdorStart2, float FirstOdorEnd2, float SecondOdorStart2, float SecondOdorEnd2, float FirstOdorStart3, float FirstOdorEnd3, float SecondOdorStart3, float SecondOdorEnd3, int Times1, int Times2, int Times3, int WaterBNC, float WaterStart1, float WaterEnd1, float WaterStart2, float WaterEnd2, float WaterStart3, float WaterEnd3, float WholeLen1, float WholeLen2, float WholeLen3, int Trigger1, float Trigger1Start, float Trigger1End, int Trigger2, float Trigger2Start, float Trigger2End, int Trigger3, float Trigger3Start, float Trigger3End, int Rule1, int Rule2, int Rule3, int TrialNuminSession, int SessionNum) ;
void AutoTwoRuleBlockTask(int Odor1, int Odor1BNC, float FirstOdorStart, float FirstOdorEnd, int Odor2, int Odor2BNC, float SecondOdorStart, float SecondOdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Trigger1, float Trigger1Start, float Trigger1End, int Trigger2, float Trigger2Start, float Trigger2End, int Rule1, int Rule2, int TrialNuminSession, int SessionNum) ;

void EightOdorGo_noGo(void) ;
void AutoTwoRuleGoNogoTask(int Odor1, int Odor1BNC, int Odor2, int Odor2BNC, float OdorStart, float OdorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Trigger1, float Trigger1Start, float Trigger1End, int Trigger2, float Trigger2Start, float Trigger2End, int Rule1, int Rule2, int TrialNuminSession, int SessionNum) ;

void TwoOdorDelayMatchTaskWithTwoTriggerWithDistructor(int Odor1, int Odor1BNC, float FirstOdorStart, float FirstOdorEnd, int Odor2, int Odor2BNC, float SecondOdorStart, float SecondOdorEnd, int OdorDistractor, int OdorDistractorBNC, float OdorDistractorStart, float OdorDistractorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Trigger1, float Trigger1Start, float Trigger1End, int Trigger2, float Trigger2Start, float Trigger2End, int Rule, int TrialNuminSession, int SessionNum) ;
void PseudoDNMSTasks(int Odor1, int LowOdor1, int Odor1BNC, float FirstOdorStart, float FirstOdorEnd, int Odor2, int LowOdor2, int Odor2BNC, float SecondOdorStart, float SecondOdorEnd, int OdorDistractor, int OdorDistractorBNC, float OdorDistractorStart, float OdorDistractorEnd, int WaterBNC, float WaterStart, float WaterEnd, float WholeLen, int Trigger1, float Trigger1Start, float Trigger1End, int Trigger2, float Trigger2Start, float Trigger2End, int Rule, int TrialNuminSession, int SessionNum) ;

void ODNMS2(int FirstOdorIn, int FirOdorLen, int OdorDelayIn, int SecondOdorIn, int SecOdorLen, int ThirdOdorIn, float WaterLIn, int IntervalIn, int prolong, float delay_before_reward); //HanZhe
void air_Go_Nogo(int thisdelay, int interti, int trialNumperSess, float WaterLen, int missstop, int sessstop, float delay_before_reward) ;
void auto_AB_BA_Go_AA_BB_Nogo_Ran2(int thisdelay, int interti, int trialNumperSess, float WaterLen, int missstop, int sessstop, float delay_before_reward);//HanZhe

void SW_deal(void);     //????, ?lcd.c??????????????S1?S5??????

#endif	/* TRIALS_H */

